<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateOtherOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('other_orders', function (Blueprint $table) {
            $table->id()->comment('会员购买记录表');
            $table->integer('user_id')->index()->comment('用户id');
            $table->integer('order_id')->index()->comment('订单号');
            $table->string('code',32)->comment('卡号');
            $table->string('type')->comment('区别 free：免费领取 memberCard：购买会员卡 superMemberCard：卡密领取会员卡');
            $table->string('member_type',32)->comment('会员类型月卡：month季卡：quarter年卡：year永久：ever免费：free 试用：tryout');
            $table->string('pay_type',255)->comment('支付方式:wechat微信,aliyun支付宝,free免费');
            $table->tinyInteger('paid')->default(0)->comment('支付状态 0:  未支付 1：已支付');
            $table->decimal('pay_price')->nullable()->comment('支付金额');
            $table->string('trade_no',32)->comment('支付宝支付,支付宝交易订单');
            $table->string('channel_type')->comment('支付渠道,微信公众号,h5,小程序');
            $table->decimal('member_price')->comment('会员卡价格');
            $table->timestamp('pay_time')->comment('会员购买时间');
            $table->tinyInteger('is_free')->comment('是否免费');
            $table->tinyInteger('is_permanent')->comment('是否永久');
            $table->timestamp('overdue_time')->comment('会员过期时间');
            $table->timestamp('vip_day')->comment('会员有效天数');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('other_orders');
    }
}
